import time
import pytest

from XuechebuLogin.Page.Page_Home import  ProxyHome
from XuechebuLogin.Page.Page_Login import PageLogin, ProxyLogin
from XuechebuLogin.utils import UtilsDriver, get_msg, get_case_data

data=get_case_data("../case_data/login_case_data.json")
class Test_login:
    def setup_class(self):
        self.proxy_home = ProxyHome()
        self.proxy_login = ProxyLogin()
        self.proxy_home.go_login()
        time.sleep(15)

    def teardown_class(self):
        UtilsDriver.quit_driver()

    @pytest.mark.parametrize("username,password,expect",data)
    def test_login_01(self,username,password,expect):
        self.proxy_login.login_page(username,password,expect)
        time.sleep(5)
        message = get_msg()
        time.sleep(2)
        self.proxy_login.confirm_page()
        assert expect in message

